<template>
  <div class="login">
    <div class="oimg"></div>
    <div class="login_box">
      <h2>用户登录</h2>
      <div class="inputs">
        <el-input v-model="username" placeholder="请输入账号"></el-input>
        <!-- <input type="text"> -->
        <el-button type="primary" @click="login">登录</el-button>
        <!-- <button></button> -->
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      username: 'admin',
    }
  },
  methods: {
    login() {
      this.$store
        .dispatch('user/login', { username: this.username })
        .then(() => {
          this.$notify({
          title: '成功',
          message: '登陆成功',
          type: 'success'
        });
          this.$router.push({
            path: this.$route.query.redirect || '/',
          })
        })
    },
  },
}
</script>
<style lang="scss" scoped>
.login {
  width: 100%;
  height: 100%;
  .oimg {
    width: 100%;
    height: 100%;
    background: url('../assets/img/bg-login2.png') no-repeat center;
    position: relative;
  }

  .login_box {
    position: absolute;
    width: 30%;
    background: #fff;
    /*  height: 400px; */
    padding: 20px;
    left: 55%;
    top: 30%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 3px 3px 6px #999;
    h2 {
      font-size: 22px;
      color: rgb(83, 77, 77);

      margin-bottom: 30px;
    }
    .inputs {
      width: 100%;
      display: flex;
      flex-direction: column;
      button {
        width: 100%;
        height: 40px;
        border: 0;
        margin: 30px 0;
      }
    }
  }
}
</style>
